package com.execl.utils;


import org.springframework.util.StringUtils;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Base64;

/**
 * 传入字符串进行 MD5 加密
 */
public class MD5Util {

    public static String getmd5(String plainText) {

        try {
            byte[] secretBytes = MessageDigest.getInstance("md5").digest(plainText.getBytes());
            String str = Base64.getEncoder().encodeToString(secretBytes);
            return str;
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException("没有这个md5算法！");
        }
    }

}